using System.ComponentModel.DataAnnotations;

namespace RAG.Domain.Entities.App;

/// <summary>
/// 对话实体
/// </summary>
public class Conversation : EntityBase
{
    public Guid Id { get; set; } //对话id
    public Guid? SessionId { get; set; } //会话id，允许为null
    public Guid UserId { get; set; } //用户id
    
    public string ConversationQuestion { get; set; } = null!; //用户问题
    public string ConversationAnswer { get; set; } = null!; //AI回答
    /// <summary>
    /// 检索到的文档片段，序列化为JSON字符串
    /// </summary>
    public string? SourceChunks { get; set; } // JSON
    
    [StringLength(100, ErrorMessage = "模型名称长度不能超过100个字符")]
    public string ConversationModel { get; set; } = null!; //使用的模型名称
    
    public int PromptTokens { get; set; } //提示词token数
    public int CompletionTokens { get; set; } //完成token数
    public int LatencyMs { get; set; } //延迟毫秒数
    
    // 导航属性
    public Session Session { get; set; } = null!;
    public Users User { get; set; } = null!;
} 